package com.demo.Mapper;

import com.demo.DemoApplicationTests;
import com.demo.mapper.SysUserModules.SysUserMapper;
import com.demo.model.Jobassembly.Jobassembly;
import com.demo.model.Jobassembly.JobassemblyQuery.JobassemblyQuery;
import com.demo.model.SysUser.SysUser;
import com.demo.tool.Base64Strategy;
import com.demo.tool.JWTUTIL;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.io.UnsupportedEncodingException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;

public class JobassemblyMapper extends DemoApplicationTests {



    @Autowired
    private com.demo.mapper.Jobassembly.JobassemblyMapper jobassemblyMapper;


    @Test
    public void findAll(){
        JobassemblyQuery jobassemblyQuery=new JobassemblyQuery();
        Calendar cal = Calendar.getInstance();
        Date date = new Date();
        cal.setTime(date);
        cal.add(Calendar.MONTH,5);
        cal.add(Calendar.YEAR,2023);
        cal.add(Calendar.DATE,25);
        jobassemblyQuery.setStartingTime(cal.getTime());
        int list=jobassemblyMapper.countNumber(jobassemblyQuery);
        System.out.println(list);
    }

    @Test
    public void add(){
        Jobassembly jobassembly=new Jobassembly();
        jobassembly.setJobName("王老吉喜气洋洋4");
        jobassembly.setProductionPlan("预计在12月前生产36吨王老吉,作用不明4");
        jobassembly.setScheduling(360);
        jobassembly.setProduct("王老吉plus1号4");
        jobassembly.setModel("王老吉晓龙版66224");
        jobassembly.setSpecification("吉之大，一瓶装不下,360吨4");
        jobassembly.setUnit("吨4");
        jobassembly.setRemark("测试一下下拉3");
        jobassembly.setProductionQuantity(366);
        jobassembly.setProductionJobMaterial("一批上好的王老吉4");
        jobassembly.setStartingTime(new Date());
        Calendar cal = Calendar.getInstance();
        Date date = new Date();
        cal.setTime(date);
        cal.add(Calendar.MONTH,2);
        jobassembly.setEndTime(cal.getTime());
        jobassemblyMapper.save(jobassembly);
    }

    @Test
    public void del(){
       int o= jobassemblyMapper.delById(4);
        System.out.println(o);
    }

    @Test
    public void dels(){
        Integer [] ids=new Integer[]{7,8};
        System.out.println(ids);
        int o= jobassemblyMapper.delByIdIn(ids);
        System.out.println(o);
    }


    @Test
    public void updata(){
        Jobassembly jobassembly=new Jobassembly();
        jobassembly.setSerialNumber(3);
        jobassembly.setJobName("6666");
        jobassembly.setProductionPlan("6666");
        jobassembly.setScheduling(6666);
        jobassembly.setProduct("6666");
        jobassembly.setModel("6666");
        jobassembly.setSpecification("6666");
        jobassembly.setUnit("6666");
        jobassembly.setRemark("6666");
        jobassembly.setProductionQuantity(6666);
        jobassembly.setProductionJobMaterial("6666");
        jobassembly.setStartingTime(new Date());
        Calendar cal = Calendar.getInstance();
        Date date = new Date();
        cal.setTime(date);
        cal.add(Calendar.MONTH,6);
        jobassembly.setEndTime(cal.getTime());
        jobassemblyMapper.update(jobassembly);
    }

    @Test
    public void cs(){
       List<Jobassembly> list=jobassemblyMapper.findAllpaging(1,3,null);
        for (Jobassembly jobassembly:list){
            System.out.print(jobassembly.getSerialNumber()+"\t");
            System.out.print(jobassembly.getProduct()+"\t");
            System.out.println();
        }
    }
}
